package com.cax.common.domain.base.vo;

import com.fasterxml.jackson.annotation.JsonProperty;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.experimental.Accessors;

import java.util.List;

/**
 * @Description: 图表对象 支持折线图、柱状图
 * @author: liangjian
 * @created: 2021年12月30日16:15:56
 */
@Data
@Accessors(chain = true)
@ApiModel(value = "EchartsVO", description = "图表对象 支持折线图、柱状图")
public class EchartsVO {

    public EchartsVO(){
    }

    public EchartsVO(List<String> xAxis, List<EchartsSeriesVO> series){
        this.xAxis = xAxis;
        this.series = series;
    }

    public EchartsVO(List<String> xAxis,List<String> xAxisKey, List<EchartsSeriesVO> series){
        this.xAxis = xAxis;
        this.xAxisKey = xAxisKey;
        this.series = series;
    }

    @ApiModelProperty(value="x轴显示值")
    //如果不设置 前端看到的就是xaxis
    @JsonProperty("xAxis")
    private List<String> xAxis;

    @ApiModelProperty(value="x轴显示值对应的标识")
    @JsonProperty("xAxisKey")
    private List<String> xAxisKey;

    @ApiModelProperty(value="y轴数据")
    @JsonProperty("series")
    private List<EchartsSeriesVO> series;

    /*
    根据前端要求 返回的数据示例
    {
        "xAxis": ['部门1', '部门2'],
        "xAxisKey": ['部门1-唯一标识', '部门2-唯一标识'],
        "series": [
            {
                "name": "总人数",
                "type": "line",
                "data": [300, 200]
            },
            {
                "name": "迟到人数",
                "type": "bar",
                "data": [5,10]
            }
        ]
    }
    */

}
